/**
 * 
 */
package pl.spikes.xmpp;

import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smackx.muc.InvitationListener;
import org.jivesoftware.smackx.muc.MultiUserChat;

import pl.spikes.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

/**
 * @author smimpin02
 *
 */
public class XMPPMultiplayerActivity extends Activity implements
		OnClickListener {

	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.xmpp_multiplayer_menu);
		View creat_game_button = this.findViewById(R.id.create_game_button);
		View join_game_button = this.findViewById(R.id.join_game_button);
		View back_button = this.findViewById(R.id.back_button);
		creat_game_button.setOnClickListener(this);
		join_game_button.setOnClickListener(this);
		back_button.setOnClickListener(this); 
	}

	/* (non-Javadoc)
	 * @see android.view.View.OnClickListener#onClick(android.view.View)
	 */
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch(v.getId()){
		case R.id.create_game_button:
			Intent prepareGame = new Intent(this, XMPPPrepareGameActivity.class);
			startActivity(prepareGame);
			break;
		case R.id.join_game_button:
			Intent joinGame = new Intent(this, XMPPJoinGameActivity.class);
			startActivity(joinGame);
			break;
		case R.id.back_button:
			XMPPLogic.getInstance().getConnection().disconnect();
			Intent login = new Intent(this, XMPPLoginActivity.class);
			startActivity(login);
			break;
		}
	}

}
